export const get = (v: string) => {
  const store = localStorage.getItem(v);
  try {
    if (store) {
      return JSON.parse(store);
    }
  } catch (error) {
    return new Object(store).valueOf();
  }
};

export const set = (k: string, v: any) => {
  let value = v;
  if (typeof v === "object") {
    value = JSON.stringify(v);
  }
  localStorage.setItem(k, value);
};

export const removeItem = (key: string) => {
  localStorage.removeItem(key);
};

export const clearStorage = () => {
  localStorage.clear();
};
